package com.gitee.liuzhi.demo.juc;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author liuzhi
 * @Date 2023/9/6 20:39
 * @Version 1.0
 * @Description AtomicIntegerTest
 */
public class AtomicIntegerDemo {

    private static final AtomicInteger ATOMIC_INTEGER = new AtomicInteger();

    private static final Integer THREAD_COUNT = 100;

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < THREAD_COUNT; i++) {
            new Thread(ATOMIC_INTEGER::incrementAndGet).start();
        }
        Thread.sleep(1000);
        System.out.println(ATOMIC_INTEGER.get());
    }

}
